import http from './../../../base/api/public'
import querystring from 'querystring'
let sysConfig = require('@/../config/sysConfig')
let apiUrl = sysConfig.xcApiUrlPre;

//=============================CMS_PAGE=======================================
//查询分页信息
export const page_list = (page, size, params) =>{
  //将json对象转成key/value对
  // let query1 = JSON.stringify(params);
  let query =  querystring.stringify(params);
  return http.requestQuickGet(apiUrl+'/cms/page/list/'+page+'/'+size+'?'+query)
}

//添加页面
export const page_add = params =>{
  return http.requestPost(apiUrl+'/cms/page/add',params)
}

//根据id查询页面信息
export const findByPageId = pageId =>{
  return http.requestQuickGet(apiUrl+'/cms/page/get/'+pageId)
}

//修改页面
export const page_edit = (pageId,params) => {
  return http.requestPut(apiUrl+'/cms/page/edit/'+pageId,params)
}

//删除页面
export const page_del = pageId => {
  return http.requestDelete(apiUrl+ '/cms/page/del/'+pageId)
}

//查询站点下拉菜单列表
export const select_site_list = () =>{
  return http.requestQuickGet(apiUrl+'/cms/page/selectSiteList')
}

//查询模板下拉菜单列表
export const select_template_list = () =>{
  return http.requestQuickGet(apiUrl+'/cms/page/selectTemplateList')
}

//=============================CMS_TEMPLATE=======================================
//查询模板分页信息
export const template_list = (page, size, params) =>{
  //将json对象转成key/value对
  // let query1 = JSON.stringify(params);
  let query =  querystring.stringify(params);
  return http.requestQuickGet(apiUrl+'/cms/template/list/'+page+'/'+size+'?'+query)
}

//添加模板
export const template_add = params =>{
  return http.requestPost(apiUrl+'/cms/template/add',params)
}

//根据id查询页面信息
export const findByTemplateId = templateId =>{
  return http.requestQuickGet(apiUrl+'/cms/template/get/'+templateId)
}

//修改模板
export const template_edit = (templateId,params) => {
  return http.requestPut(apiUrl+'/cms/template/edit/'+templateId,params)
}

//删除模板
export const template_del = templateId => {
  return http.requestDelete(apiUrl+ '/cms/template/del/'+templateId)
}




